// https://nuxt.com/docs/api/configuration/nuxt-config

export default defineNuxtConfig({
  modules: ["@element-plus/nuxt"],
  nitro: {
    devProxy: {
      "/api": {
        target: "http://localhost:5012",
        changeOrigin: true,
        prependPath: true,
      },
    },
    // 该配置用于服务端请求转发
    routeRules: {
      "/api/**": {
        proxy: "http://localhost:3001/**",
      },
    },
  },
  vite: {
    server: {
      proxy: {
        "/api": {
          target: "http://localhost:5012",
          changeOrigin: true,
          rewrite: (path) => path.replace(/^\/api/, ""),
        },
      },
    },
  },
});
